<?php
require_once 'DB.class.php';

class ListTools {
	

	public function OdList(){
		
		$i=1;
		$result = mysql_query("SELECT * FROM  `od` ORDER BY `o_id` DESC LIMIT 0 , 300");
			while($row = mysql_fetch_array($result))
			{
				$stamp = $row['o_date'];
				switch ($row['o_status']) {
					case 1:
						$stat = "<span class=\"tag gray\">Collect</span>";
						break;
					case 2:
						$stat = "<span class=\"tag red\">Washing</span>";
						break;
					case 3:
						$stat = "<span class=\"tag green\">Done</span>";
						break;
				}
				echo "<tr>";
				echo "<td>". sprintf("%06d", $row['o_id']) ."</td>";
				echo "<td>Admin</td>";
				echo "<td>". date("Y/m/d", $stamp) ."</td>";
				echo "<td>". $stat ."</td>";
				echo "<td>";
				echo "<ul class=\"actions\">";
				echo 	"<li><a class=\"view\" href=\"#\" rel=\"tooltip\" original-title=\"View Item\">view</a></li>";
				echo	"<li><a class=\"edit\" href=\"#\" rel=\"tooltip\" original-title=\"Edit Item\">edit</a></li>";
				echo	"<li><a class=\"delete\" href=\"#\" rel=\"tooltip\" original-title=\"Delete Item\">delete</a></li>";
				echo "</ul>";
				echo "</td>";
				echo "</tr>";
				
				$i++;
			}
	}
	
	public function ItemList(){
		$i=1;
		$result = mysql_query("SELECT * FROM  `itemcode` ORDER BY `i_itemcode` DESC LIMIT 0 , 300");
			while($row = mysql_fetch_array($result))
			{
				$stamp = $row['i_regdate'];
				echo "<tr>";
				echo "<td>". sprintf("%06d", $row['i_itemcode']) ."</td>";
				echo "<td>". $row['i_itemcolor'] ."</td>";
				echo "<td>". $row['i_itemtype'] ."</td>";
				echo "<td> NULL </td>";
				echo "<td>";
				echo "<ul class=\"actions\">";
				echo 	"<li><a class=\"view\" href=\"item-view.php?code=".$row['i_itemcode']."\" rel=\"tooltip\" original-title=\"View Item\">view</a></li>";
				echo	"<li><a class=\"edit\" href=\"item-edit.php?code=".$row['i_itemcode']."\" rel=\"tooltip\" original-title=\"Edit Item\">edit</a></li>";
				echo	"<li><a class=\"delete\" href=\"item-delete.php?code=".$row['i_itemcode']."\" rel=\"tooltip\" original-title=\"Delete Item\">delete</a></li>";
				echo "</ul>";
				echo "</td>";
				echo "</tr>";
				
				$i++;
			}
	}
	public function ItemView($ItemCode,$Element){
		$result = mysql_query("	SELECT * 
								FROM  `itemcode` 
								WHERE  `i_itemcode` =".$ItemCode."");
		while($row = mysql_fetch_array($result))
		{
			switch ($Element) {
					case 1:
						return $row['i_itemtype'];
						break;
					case 2:
						return $row['i_itemcolor'];
						break;
					case 3:
						return $row['i_remark'];
						break;
				}
		}
	}
	public function ItemRemove($ItemCode){
		$sql = "DELETE FROM `laundrybox`.`itemcode` WHERE `itemcode`.`i_itemcode` = ".$ItemCode.""; 
		mysql_query($sql);
	}
}
?>
